package org.example.csc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.csc.entity.Admin;
import org.example.csc.mapper.AdminMapper;
import org.example.csc.service.Adminservice;
import org.springframework.stereotype.Service;

import java.security.Provider;

@Service
public class AdminServiceimpl extends ServiceImpl<AdminMapper, Admin> implements Adminservice {

    @Override
    public boolean add(Admin admin){
       QueryWrapper<Admin> query =  Wrappers.query(Admin.class);
       query.eq("username",admin.getUsername());
       Admin a =getOne(query);
       if(a !=null){
           return false;
       }
      return save(admin);
    }

    @Override
    public boolean login(String username, String password){
        return false;
    }
}
